/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PanelRouter.java
 *
 * Created on 08/02/2012, 13:16:41
 */
package tsb.UI.Paneles.ROUTER;

import java.awt.Component;
import java.awt.event.KeyEvent;
import java.awt.Dimension;
import java.awt.Font;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer;
import javax.swing.ImageIcon;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.ListCellRenderer;
import tsb.UI.Paneles.PC.PanelEthernet;
import tsb.UI.Paneles.PC.PanelFastEthernetFibra;
import tsb.UI.Paneles.PC.PanelFastEthernetRJ45;
import tsb.UI.Paneles.PC.PanelGigabitFibra;
import tsb.UI.Paneles.PC.PanelModemPC;
import tsb.UI.Paneles.PanelSerial;
import tsb.UI.Paneles.PanelWireless;
import tsb.UI.Ventanas.VentanaDeError;
import tsb.UI.Ventanas.VentanaRouter;
import tsb.dominio.interfaces.Wireless;
import tsb.dominio.interfaces.Ethernet;
import tsb.dominio.interfaces.FastEthernet;
import tsb.dominio.interfaces.FibraOpticaFastEthernet;
import tsb.dominio.interfaces.FibraOpticaGigabit;
import tsb.dominio.interfaces.InterfaceDeConeccion;
import tsb.dominio.interfaces.InterfazModemPC;
import tsb.dominio.interfaces.RJ45Gigabit;
import tsb.dominio.interfaces.Serial;
import tsb.UI.consola.Arbol;
import tsb.UI.consola.Consola;
/**
 *
 * @author Fede
 */
public class PanelRouter extends javax.swing.JPanel {
     private boolean pestañas []= new boolean[10]; // si la posiscion i es true es que esta ocupada
    
     private ArrayList<InterfaceDeConeccion> listaInterfaces;
     ImageIcon[] images;
     String[] opciones = {"Si","No"};
     String[] cadena=new String[10];//no se pueden escribir sentencias de mas de 10 lineas
     Integer[] intArray;
    private VentanaRouter ventanaRouter;
    private Consola cons;
    private Arbol arbol;
    /** Creates new form PanelRouter */

    public PanelRouter(VentanaRouter ventanaR) {
        images = new ImageIcon[opciones.length];
        intArray = new Integer[opciones.length];
        for (int i = 0; i < opciones.length; i++) {
            intArray[i] = new Integer(i);
            if(i==0)
            {images[i] = new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/PRENDIDO_16X16.png"));
            }
            else
            {images[i] = new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/APAGADO_16X16.png"));
            }
            if (images[i] != null) {
                images[i].setDescription(opciones[i]);
            }
        }
        initComponents();
        ComboBoxRenderer renderer= new ComboBoxRenderer();
        renderer.setPreferredSize(new Dimension(10, 20));
        this.cmbencendido.setRenderer(renderer);

        listaInterfaces = new ArrayList<InterfaceDeConeccion>();
        for(int i=0; i<pestañas.length;i++)
        {
            pestañas[i]=false;
        }
        for(int i=0; i<cadena.length;i++)
        {
            cadena[i]="";
        }
        ventanaRouter=ventanaR;
        cons= new Consola();
        arbol=cons.getArbol();
    }
    
    //devuleve la cantidad de pestañas ocupadas
    private int cantidadPestañas()
    {
        int cont=0;
        for(int i=0;i<this.pestañas.length;i++)
        {
            if(this.pestañas[1]==true)
            {
                cont++;
            }
        }
        return cont;
    }
    
    private int pisicionLibre()
    {
        for(int i=0;i<this.pestañas.length;i++)
        {
            if(this.pestañas[i]==false)
            {
                return i;
            }
        }
        return -1;
    }
    
     public void setNombreAMostrar(String nombre)
    {
        this.txtNombreAMostrar.setText(nombre);
    }
    
    public String getNombreAMostrar()
    {
        return this.txtNombreAMostrar.getText();
    }
    
    public void setEncendido(boolean encendido)
    {
        if(encendido)
        {
            this.cmbencendido.setSelectedIndex(0);
        }
        else
        {
            this.cmbencendido.setSelectedIndex(1);
        }
    }

    public void setHostName (String hostName)
    {
        this.txtHostname.setText(hostName);
    }
    public String getHostName()
    {
        return this.txtHostname.getText();
    }
    
    public boolean getEncendido()
    {
        if(this.cmbencendido.getSelectedIndex()==0)
            return true;
        else
            return false;
    }
    
    public JPanel getPanelPestañaInterfaz1() {
        return panelPestañaInterfaz1;
    }

    public JPanel getPanelPestañaInterfaz10() {
        return panelPestañaInterfaz10;
    }

    public JPanel getPanelPestañaInterfaz3() {
        return panelPestañaInterfaz3;
    }

    public JPanel getPanelPestañaInterfaz4() {
        return panelPestañaInterfaz4;
    }

    public JPanel getPanelPestañaInterfaz5() {
        return panelPestañaInterfaz5;
    }

    public JPanel getPanelPestañaInterfaz6() {
        return panelPestañaInterfaz6;
    }

    public JPanel getPanelPestañaInterfaz7() {
        return panelPestañaInterfaz7;
    }

    public JPanel getPanelPestañaInterfaz8() {
        return panelPestañaInterfaz8;
    }

    public JPanel getPanelPestañaInterfaz9() {
        return panelPestañaInterfaz9;
    }

    public JPanel getPanelPestañainterfaz2() {
        return panelPestañainterfaz2;
    }

    public boolean[] getPestañas() {
        return pestañas;
    }
    
    private void insertarPanel(javax.swing.JPanel p, String panel, int pestaña)
    {
        switch(pestaña)
        {
            case 0:
                this.panelPestañaInterfaz1.add(p);
                pestañasInterfaces.setTitleAt(0, panel);
                //this.pestaña1=true;
                this.pestañas[0]=true;
                this.btnQuitarInterfazPestaña1.setVisible(true);
                break;
            case 1:
                this.panelPestañainterfaz2.add(p);
                pestañasInterfaces.setTitleAt(1, panel);
               // this.pestaña2=true;
                this.pestañas[1]=true;
                this.btnQuitarInterfazPestaña2.setVisible(true);
                break;
            case 2:
                this.panelPestañaInterfaz3.add(p);
                pestañasInterfaces.setTitleAt(2, panel);
              //  this.pestaña3=true;
                this.pestañas[2]=true;
                this.btnQuitarInterfazPestaña3.setVisible(true);
                break;
            case 3:
                this.panelPestañaInterfaz4.add(p);
                pestañasInterfaces.setTitleAt(3, panel);
                //this.pestaña4=true;
                this.pestañas[3]=true;
                this.btnQuitarInterfazPestaña4.setVisible(true);
                break;
            case 4:
                this.panelPestañaInterfaz5.add(p);
                pestañasInterfaces.setTitleAt(4, panel);
               // this.pestaña5=true;
                this.pestañas[4]=true;
                this.btnQuitarInterfazPestaña5.setVisible(true);
                break;
            case 5:
                this.panelPestañaInterfaz6.add(p);
                pestañasInterfaces.setTitleAt(5, panel);
                //this.pestaña6=true;
                this.pestañas[5]=true;
                this.btnQuitarInterfazPestaña6.setVisible(true);
                break;
            case 6:
                this.panelPestañaInterfaz7.add(p);
                pestañasInterfaces.setTitleAt(6, panel);
                //this.pestaña7=true;
                this.pestañas[6]=true;
                this.btnQuitarInterfazPestaña7.setVisible(true);
                break;
            case 7:
                this.panelPestañaInterfaz8.add(p);
                pestañasInterfaces.setTitleAt(7, panel);
               //this.pestaña8=true;
                this.pestañas[7]=true;
                this.btnQuitarInterfazPestaña8.setVisible(true);
                break;
            case 8:
                this.panelPestañaInterfaz9.add(p);
                pestañasInterfaces.setTitleAt(8, panel);
                //this.pestaña9=true;
                this.pestañas[8]=true;
                this.btnQuitarInterfazPestaña9.setVisible(true);
                break;
            case 9:
                this.panelPestañaInterfaz10.add(p);
                pestañasInterfaces.setTitleAt(9, panel);
                //this.pestaña10=true;
                this.pestañas[9]=true;
                this.btnQuitarInterfazPestaña10.setVisible(true);
                break;
        }

    }
 
 public void agregarInterfaces(ArrayList listaInterfaces)
    {
       // int contador= 1;
        int val=0;
        Iterator iter= listaInterfaces.iterator();
        while(iter.hasNext())
        {
           InterfaceDeConeccion i= (InterfaceDeConeccion)iter.next();

           if(i instanceof Ethernet)
           {
                     PanelEthernet pe = new PanelEthernet();
                    // pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Ethernet",this.pisicionLibre());
                     pe.setCampos((Ethernet)i);
                    // contador++;

           }
          if(i instanceof FibraOpticaFastEthernet)
          {
                     PanelFastEthernetFibra pe = new PanelFastEthernetFibra();
                     //pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Fast Ethernet Fibra",this.pisicionLibre());
                     pe.setCampos((FibraOpticaFastEthernet)i);
                     //contador++;

          }
          if(i instanceof FastEthernet)
          {
                     PanelFastEthernetRJ45 pe = new PanelFastEthernetRJ45();
                     //pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Fast Ethernet RJ45",this.pisicionLibre());
                     pe.setCampos((FastEthernet)i);
                     //contador++;

          }
          if(i instanceof RJ45Gigabit)
          {
                     PanelGigabitEthernetRouter pe = new PanelGigabitEthernetRouter();
                   //  pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Gigabit RJ45",this.pisicionLibre());
                     pe.setCampos((RJ45Gigabit)i);
                     //contador++;
          }
          if(i instanceof FibraOpticaGigabit)
          {
                     PanelGigabitFibra pe = new PanelGigabitFibra();
                    // pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Gigabit Fibra Óptica",this.pisicionLibre());
                     pe.setCampos((FibraOpticaGigabit)i);
                    // contador++;
          }
          if(i instanceof InterfazModemPC)
          {
                     PanelModemPC pe = new PanelModemPC();
                   //  pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Modem",this.pisicionLibre());
                     pe.setCampos((InterfazModemPC)i);
                     //contador++;
          }
          if(i instanceof Serial)
          {
                     PanelSerial pe = new PanelSerial();
                   //  pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Serial",this.pisicionLibre());
                     pe.setCampos((Serial)i);
                     //contador++;
          }
          if(i instanceof Wireless)
          {
                     PanelWireless pe = new PanelWireless();
                   //  pe.setAsignacion(this.getAsignacionIP());
                     pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                     this.insertarPanelPosicion(pe,"Wireless",this.pisicionLibre());
                     pe.setCampos((Wireless)i);
                     //contador++;
          }
        }
    }
 
 
 public InterfaceDeConeccion getInterfaz(javax.swing.JPanel panelPestañaInterfaz)
    {
        Component c= panelPestañaInterfaz.getComponent(1);
        if(panelPestañaInterfaz.getComponent(1) instanceof tsb.UI.Paneles.ROUTER.PanelEthernetRouter)
        {
            PanelEthernetRouter pe = (PanelEthernetRouter)panelPestañaInterfaz.getComponent(1);
            return pe.getEthernet();
        }
        else
        {
            if(panelPestañaInterfaz.getComponent(1) instanceof tsb.UI.Paneles.ROUTER.PanelFastEthernetRouter)
            {
                tsb.UI.Paneles.ROUTER.PanelFastEthernetRouter pe = (tsb.UI.Paneles.ROUTER.PanelFastEthernetRouter)panelPestañaInterfaz.getComponent(1);
                return pe.getFastEthernet();
            }
            else
            {
                if(panelPestañaInterfaz.getComponent(1) instanceof tsb.UI.Paneles.ROUTER.PanelGigabitFibraRouter)
                {
                    PanelGigabitFibraRouter pe = (PanelGigabitFibraRouter)panelPestañaInterfaz.getComponent(1);
                    return pe.getFibraOpticaGigabit();
                }
                else
                {
                    if(panelPestañaInterfaz.getComponent(1) instanceof tsb.UI.Paneles.ROUTER.PanelGigabitEthernetRouter)
                    {
                        PanelGigabitEthernetRouter pe = (PanelGigabitEthernetRouter)panelPestañaInterfaz.getComponent(1);
                        return pe.getEthernetGigabit();
                    }
                    else
                    {
                        if(panelPestañaInterfaz.getComponent(1) instanceof tsb.UI.Paneles.ROUTER.PanelGigabitFibraRouter)
                        {//acaaaa
                            PanelGigabitFibra pe = (PanelGigabitFibra)panelPestañaInterfaz.getComponent(1);
                            return pe.getFibraOpticaGigabit();
                        }
                        else
                        {
                            if(panelPestañaInterfaz.getComponent(1) instanceof tsb.UI.Paneles.PC.PanelModemPC)
                            {
                                PanelModemPC pe = (PanelModemPC)panelPestañaInterfaz.getComponent(1);
                                return pe.getInterfazModem();
                            }
                            else
                            {
                                if(panelPestañaInterfaz.getComponent(1) instanceof tsb.UI.Paneles.ROUTER.PanelSerialRouter)
                                {
                                    PanelSerialRouter pe = (PanelSerialRouter)panelPestañaInterfaz.getComponent(1);
                                    return pe.getSerial();
                                }
                                else
                                {
                                     if(panelPestañaInterfaz.getComponent(1) instanceof tsb.UI.Paneles.ROUTER.PanelWirelessRouter)
                                    {
                                        PanelWirelessRouter pe = (PanelWirelessRouter)panelPestañaInterfaz.getComponent(1);
                                        return pe.getWireless();
                                    }
                                }
                                
                            }
                            
                        }
                        
                    }
                    
                }
                
            }
        }
        return null;
    }
 
 private void insertarPanelPosicion(javax.swing.JPanel p, String panel,int orden)
    {
//        int aux=0;
//        for(int i=0;i <this.pestañas.length;i++)
//        {
//            if(pestañas[i]==false)
//            {
//                aux=i+1;
//                break;
//            }
//        }

        switch(orden)
        {
            case 0: //Cuando está lleno
                VentanaDeError.mostrarDialog("No se puede agregar interfaz", "             El Router solo acepta 10 Interfaces de coneccion.\nPara agregar una nueva debe quitar alguna de las interfaces actuales", 0);
             break;
            case 1:
                this.panelPestañaInterfaz1.add(p);
                pestañasInterfaces.setTitleAt(0, panel);
                //pestaña1=true;
                this.btnQuitarInterfazPestaña1.setVisible(true);
                break;
            case 2:
                this.panelPestañainterfaz2.add(p);
                pestañasInterfaces.setTitleAt(1, panel);
              //  pestaña2=true;
                this.btnQuitarInterfazPestaña2.setVisible(true);
                break;
            case 3:
                this.panelPestañaInterfaz3.add(p);
                pestañasInterfaces.setTitleAt(2, panel);
               // pestaña3=true;
                this.btnQuitarInterfazPestaña3.setVisible(true);
                break;
            case 4:
                this.panelPestañaInterfaz4.add(p);
                pestañasInterfaces.setTitleAt(3, panel);
               // pestaña4=true;
                this.btnQuitarInterfazPestaña4.setVisible(true);
                break;
            case 5:
                this.panelPestañaInterfaz5.add(p);
                pestañasInterfaces.setTitleAt(4, panel);
              //  pestaña5=true;
                this.btnQuitarInterfazPestaña5.setVisible(true);
                break;
            case 6:
                this.panelPestañaInterfaz6.add(p);
                pestañasInterfaces.setTitleAt(5, panel);
              //  pestaña6=true;
                this.btnQuitarInterfazPestaña6.setVisible(true);
                break;
            case 7:
                this.panelPestañaInterfaz7.add(p);
                pestañasInterfaces.setTitleAt(6, panel);
              //  pestaña7=true;
                this.btnQuitarInterfazPestaña7.setVisible(true);
                break;
            case 8:
                this.panelPestañaInterfaz8.add(p);
                pestañasInterfaces.setTitleAt(7, panel);
              //  pestaña8=true;
                this.btnQuitarInterfazPestaña8.setVisible(true);
                break;
            case 9:
                this.panelPestañaInterfaz9.add(p);
                pestañasInterfaces.setTitleAt(8, panel);
              //  pestaña9=true;
                this.btnQuitarInterfazPestaña9.setVisible(true);
                break;
            case 10:
                this.panelPestañaInterfaz10.add(p);
                pestañasInterfaces.setTitleAt(9, panel);
               // pestaña10=true;
                this.btnQuitarInterfazPestaña10.setVisible(true);
                break;
        }

   
    
    }
 
 


    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Pestañas = new javax.swing.JTabbedPane();
        panelConfiguraciones = new javax.swing.JPanel();
        txtNombreAMostrar = new javax.swing.JTextField();
        labelNombreAMostrar = new javax.swing.JLabel();
        cmbencendido = new javax.swing.JComboBox(intArray);
        labelNVRAM = new javax.swing.JLabel();
        labelHostname = new javax.swing.JLabel();
        txtHostname = new javax.swing.JTextField();
        jSeparator1 = new javax.swing.JSeparator();
        labelEncendido = new javax.swing.JLabel();
        btnBorrarNVRAM = new javax.swing.JButton();
        btnGuardarNVRAM = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JSeparator();
        jLabel4 = new javax.swing.JLabel();
        btnCargarStartupConfig = new javax.swing.JButton();
        btnExportarStartupConfig = new javax.swing.JButton();
        labelRunnigConfig = new javax.swing.JLabel();
        btnCargarRunningConfig = new javax.swing.JButton();
        btnExportarRunningConfig = new javax.swing.JButton();
        panelInterfaces = new javax.swing.JPanel();
        cmbIntefaces = new javax.swing.JComboBox();
        btnAgregar = new javax.swing.JButton();
        pestañasInterfaces = new javax.swing.JTabbedPane();
        panelPestañaInterfaz1 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña1 = new javax.swing.JButton();
        panelPestañainterfaz2 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña2 = new javax.swing.JButton();
        panelPestañaInterfaz3 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña3 = new javax.swing.JButton();
        panelPestañaInterfaz4 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña4 = new javax.swing.JButton();
        panelPestañaInterfaz5 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña5 = new javax.swing.JButton();
        panelPestañaInterfaz6 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña6 = new javax.swing.JButton();
        panelPestañaInterfaz7 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña7 = new javax.swing.JButton();
        panelPestañaInterfaz8 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña8 = new javax.swing.JButton();
        panelPestañaInterfaz9 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña9 = new javax.swing.JButton();
        panelPestañaInterfaz10 = new javax.swing.JPanel();
        btnQuitarInterfazPestaña10 = new javax.swing.JButton();
        labelInterfacesDeConeccion = new javax.swing.JLabel();
        panelRouting = new javax.swing.JPanel();
        pestañasRoutering = new javax.swing.JTabbedPane();
        panelStatic = new javax.swing.JPanel();
        labelNetwork = new javax.swing.JLabel();
        txtNetworkStatic = new javax.swing.JTextField();
        labelMask = new javax.swing.JLabel();
        txtMask = new javax.swing.JTextField();
        labelNextHop = new javax.swing.JLabel();
        txtNextHop = new javax.swing.JTextField();
        btnAddStatic = new javax.swing.JButton();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTable1 = new javax.swing.JTable();
        btnRemoveStatic = new javax.swing.JButton();
        panelRIP = new javax.swing.JPanel();
        labelNetwork1 = new javax.swing.JLabel();
        txtNetworkRIP = new javax.swing.JTextField();
        btnAddRIP = new javax.swing.JButton();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblDireccionesDeRed = new javax.swing.JTable();
        btnRemoveRIP = new javax.swing.JButton();
        panelConsola = new javax.swing.JPanel();
        jScrollPane3 = new javax.swing.JScrollPane();
        txtAConsola = new javax.swing.JTextArea();
        txtComando = new javax.swing.JTextField();

        Pestañas.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

        panelConfiguraciones.setBackground(new java.awt.Color(255, 255, 255));

        txtNombreAMostrar.setHorizontalAlignment(javax.swing.JTextField.RIGHT);

        labelNombreAMostrar.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelNombreAMostrar.setText("Nombre a Mostrar:");

        labelNVRAM.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelNVRAM.setText("NVRAM:");

        labelHostname.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelHostname.setText("Hostname:");

        labelEncendido.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelEncendido.setText("Encendido:");

        btnBorrarNVRAM.setText("Borrar");

        btnGuardarNVRAM.setText("Guardar");

        jLabel4.setFont(new java.awt.Font("Tahoma", 0, 14));
        jLabel4.setText("Startup Config:");

        btnCargarStartupConfig.setText("Cargar...");

        btnExportarStartupConfig.setText("Exportar...");

        labelRunnigConfig.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelRunnigConfig.setText("Running Config:");

        btnCargarRunningConfig.setText("Cargar...");

        btnExportarRunningConfig.setText("Exportar...");

        javax.swing.GroupLayout panelConfiguracionesLayout = new javax.swing.GroupLayout(panelConfiguraciones);
        panelConfiguraciones.setLayout(panelConfiguracionesLayout);
        panelConfiguracionesLayout.setHorizontalGroup(
            panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                        .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                                .addComponent(labelEncendido)
                                .addGap(50, 50, 50)
                                .addComponent(cmbencendido, javax.swing.GroupLayout.PREFERRED_SIZE, 69, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 152, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                                    .addComponent(labelNombreAMostrar)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                    .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(txtHostname, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)
                                        .addComponent(txtNombreAMostrar, javax.swing.GroupLayout.DEFAULT_SIZE, 221, Short.MAX_VALUE)))
                                .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                                    .addComponent(labelHostname)
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 273, javax.swing.GroupLayout.PREFERRED_SIZE))))
                        .addGap(70, 70, 70))
                    .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                        .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE)
                            .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                                .addComponent(jLabel4)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(btnCargarStartupConfig)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnExportarStartupConfig))
                            .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                                .addComponent(labelRunnigConfig)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnCargarRunningConfig)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnExportarRunningConfig)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 137, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addContainerGap())
                    .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                        .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                                .addComponent(labelNVRAM)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnBorrarNVRAM)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(btnGuardarNVRAM)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 217, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jSeparator1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 410, Short.MAX_VALUE))
                        .addContainerGap())))
        );
        panelConfiguracionesLayout.setVerticalGroup(
            panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelConfiguracionesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbencendido, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(labelEncendido))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelNombreAMostrar)
                    .addComponent(txtNombreAMostrar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelHostname)
                    .addComponent(txtHostname, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(13, 13, 13)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelNVRAM)
                    .addComponent(btnBorrarNVRAM)
                    .addComponent(btnGuardarNVRAM))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(btnCargarStartupConfig)
                    .addComponent(btnExportarStartupConfig))
                .addGap(18, 18, 18)
                .addGroup(panelConfiguracionesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelRunnigConfig)
                    .addComponent(btnCargarRunningConfig)
                    .addComponent(btnExportarRunningConfig))
                .addContainerGap(214, Short.MAX_VALUE))
        );

        Pestañas.addTab("Configuraciones", new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/CONFIGURACIONES2_16X16.png")), panelConfiguraciones); // NOI18N

        panelInterfaces.setBackground(new java.awt.Color(255, 255, 255));

        cmbIntefaces.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Ethernet", "Fast Ethernet RJ45", "Fast Ethernet Fibra Optica", "Gigabit RJ45", "Gigabit Fibra Optica", "Serial", "Wireless" }));

        btnAgregar.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/add16x16.png"))); // NOI18N
        btnAgregar.setText("Agregar");
        btnAgregar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAgregarActionPerformed(evt);
            }
        });

        pestañasInterfaces.setTabLayoutPolicy(javax.swing.JTabbedPane.SCROLL_TAB_LAYOUT);

        panelPestañaInterfaz1.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña1.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña1ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañaInterfaz1Layout = new javax.swing.GroupLayout(panelPestañaInterfaz1);
        panelPestañaInterfaz1.setLayout(panelPestañaInterfaz1Layout);
        panelPestañaInterfaz1Layout.setHorizontalGroup(
            panelPestañaInterfaz1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz1Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña1))
        );
        panelPestañaInterfaz1Layout.setVerticalGroup(
            panelPestañaInterfaz1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz1Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña1))
        );

        pestañasInterfaces.addTab("Interfaz 1", panelPestañaInterfaz1);

        panelPestañainterfaz2.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña2.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña2ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañainterfaz2Layout = new javax.swing.GroupLayout(panelPestañainterfaz2);
        panelPestañainterfaz2.setLayout(panelPestañainterfaz2Layout);
        panelPestañainterfaz2Layout.setHorizontalGroup(
            panelPestañainterfaz2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañainterfaz2Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña2))
        );
        panelPestañainterfaz2Layout.setVerticalGroup(
            panelPestañainterfaz2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañainterfaz2Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña2))
        );

        pestañasInterfaces.addTab("Interfaz 2", panelPestañainterfaz2);

        panelPestañaInterfaz3.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña3.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña3ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañaInterfaz3Layout = new javax.swing.GroupLayout(panelPestañaInterfaz3);
        panelPestañaInterfaz3.setLayout(panelPestañaInterfaz3Layout);
        panelPestañaInterfaz3Layout.setHorizontalGroup(
            panelPestañaInterfaz3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz3Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña3))
        );
        panelPestañaInterfaz3Layout.setVerticalGroup(
            panelPestañaInterfaz3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz3Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña3))
        );

        pestañasInterfaces.addTab("Interfaz 3", panelPestañaInterfaz3);

        panelPestañaInterfaz4.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña4.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañaInterfaz4Layout = new javax.swing.GroupLayout(panelPestañaInterfaz4);
        panelPestañaInterfaz4.setLayout(panelPestañaInterfaz4Layout);
        panelPestañaInterfaz4Layout.setHorizontalGroup(
            panelPestañaInterfaz4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz4Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña4))
        );
        panelPestañaInterfaz4Layout.setVerticalGroup(
            panelPestañaInterfaz4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz4Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña4))
        );

        pestañasInterfaces.addTab("Interfaz 4", panelPestañaInterfaz4);

        panelPestañaInterfaz5.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña5.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña5.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña5.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña5ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañaInterfaz5Layout = new javax.swing.GroupLayout(panelPestañaInterfaz5);
        panelPestañaInterfaz5.setLayout(panelPestañaInterfaz5Layout);
        panelPestañaInterfaz5Layout.setHorizontalGroup(
            panelPestañaInterfaz5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz5Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña5))
        );
        panelPestañaInterfaz5Layout.setVerticalGroup(
            panelPestañaInterfaz5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz5Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña5))
        );

        pestañasInterfaces.addTab("Interfaz 5", panelPestañaInterfaz5);

        panelPestañaInterfaz6.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña6.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña6.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña6ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañaInterfaz6Layout = new javax.swing.GroupLayout(panelPestañaInterfaz6);
        panelPestañaInterfaz6.setLayout(panelPestañaInterfaz6Layout);
        panelPestañaInterfaz6Layout.setHorizontalGroup(
            panelPestañaInterfaz6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz6Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña6))
        );
        panelPestañaInterfaz6Layout.setVerticalGroup(
            panelPestañaInterfaz6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz6Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña6))
        );

        pestañasInterfaces.addTab("Interfaz 6", panelPestañaInterfaz6);

        panelPestañaInterfaz7.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña7.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña7.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña7ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañaInterfaz7Layout = new javax.swing.GroupLayout(panelPestañaInterfaz7);
        panelPestañaInterfaz7.setLayout(panelPestañaInterfaz7Layout);
        panelPestañaInterfaz7Layout.setHorizontalGroup(
            panelPestañaInterfaz7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz7Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña7))
        );
        panelPestañaInterfaz7Layout.setVerticalGroup(
            panelPestañaInterfaz7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz7Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña7))
        );

        pestañasInterfaces.addTab("Interfaz 7", panelPestañaInterfaz7);

        panelPestañaInterfaz8.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña8.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña8.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña8ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañaInterfaz8Layout = new javax.swing.GroupLayout(panelPestañaInterfaz8);
        panelPestañaInterfaz8.setLayout(panelPestañaInterfaz8Layout);
        panelPestañaInterfaz8Layout.setHorizontalGroup(
            panelPestañaInterfaz8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz8Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña8))
        );
        panelPestañaInterfaz8Layout.setVerticalGroup(
            panelPestañaInterfaz8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz8Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña8))
        );

        pestañasInterfaces.addTab("Interfaz 8", panelPestañaInterfaz8);

        panelPestañaInterfaz9.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña9.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña9.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña9.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña9ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañaInterfaz9Layout = new javax.swing.GroupLayout(panelPestañaInterfaz9);
        panelPestañaInterfaz9.setLayout(panelPestañaInterfaz9Layout);
        panelPestañaInterfaz9Layout.setHorizontalGroup(
            panelPestañaInterfaz9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz9Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña9))
        );
        panelPestañaInterfaz9Layout.setVerticalGroup(
            panelPestañaInterfaz9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz9Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña9))
        );

        pestañasInterfaces.addTab("Interfaz 9", panelPestañaInterfaz9);

        panelPestañaInterfaz10.setBackground(new java.awt.Color(255, 255, 255));

        btnQuitarInterfazPestaña10.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnQuitarInterfazPestaña10.setText("Quitar Interfaz");
        btnQuitarInterfazPestaña10.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnQuitarInterfazPestaña10ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelPestañaInterfaz10Layout = new javax.swing.GroupLayout(panelPestañaInterfaz10);
        panelPestañaInterfaz10.setLayout(panelPestañaInterfaz10Layout);
        panelPestañaInterfaz10Layout.setHorizontalGroup(
            panelPestañaInterfaz10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz10Layout.createSequentialGroup()
                .addContainerGap(273, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña10))
        );
        panelPestañaInterfaz10Layout.setVerticalGroup(
            panelPestañaInterfaz10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelPestañaInterfaz10Layout.createSequentialGroup()
                .addContainerGap(329, Short.MAX_VALUE)
                .addComponent(btnQuitarInterfazPestaña10))
        );

        pestañasInterfaces.addTab("Interfaz 10", panelPestañaInterfaz10);

        labelInterfacesDeConeccion.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelInterfacesDeConeccion.setText("Interfaces de Conección");

        javax.swing.GroupLayout panelInterfacesLayout = new javax.swing.GroupLayout(panelInterfaces);
        panelInterfaces.setLayout(panelInterfacesLayout);
        panelInterfacesLayout.setHorizontalGroup(
            panelInterfacesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInterfacesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelInterfacesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(pestañasInterfaces, javax.swing.GroupLayout.PREFERRED_SIZE, 403, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addGroup(panelInterfacesLayout.createSequentialGroup()
                        .addComponent(cmbIntefaces, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(btnAgregar))
                    .addComponent(labelInterfacesDeConeccion))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        panelInterfacesLayout.setVerticalGroup(
            panelInterfacesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelInterfacesLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelInterfacesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbIntefaces, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(btnAgregar))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(labelInterfacesDeConeccion)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(pestañasInterfaces, javax.swing.GroupLayout.PREFERRED_SIZE, 382, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        Pestañas.addTab("Interfaces", new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/CONEXIONES_16X16.png")), panelInterfaces); // NOI18N

        panelRouting.setBackground(new java.awt.Color(255, 255, 255));

        panelStatic.setBackground(new java.awt.Color(255, 255, 255));

        labelNetwork.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelNetwork.setText("Network:");

        labelMask.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelMask.setText("Mask:");

        labelNextHop.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelNextHop.setText("Next Hop:");

        btnAddStatic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/add16x16.png"))); // NOI18N
        btnAddStatic.setText("Agregar");

        jTable1.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Title 1", "Title 2"
            }
        ));
        jScrollPane1.setViewportView(jTable1);

        btnRemoveStatic.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnRemoveStatic.setText("Eliminar");

        javax.swing.GroupLayout panelStaticLayout = new javax.swing.GroupLayout(panelStatic);
        panelStatic.setLayout(panelStaticLayout);
        panelStaticLayout.setHorizontalGroup(
            panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelStaticLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelStaticLayout.createSequentialGroup()
                        .addGroup(panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(panelStaticLayout.createSequentialGroup()
                                .addGroup(panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(labelNetwork)
                                    .addComponent(labelMask))
                                .addGap(18, 18, 18)
                                .addGroup(panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtNetworkStatic, javax.swing.GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE)
                                    .addComponent(txtMask, javax.swing.GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE)))
                            .addGroup(panelStaticLayout.createSequentialGroup()
                                .addComponent(labelNextHop)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(txtNextHop, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE))
                            .addComponent(btnAddStatic, javax.swing.GroupLayout.Alignment.TRAILING))
                        .addGap(117, 117, 117))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelStaticLayout.createSequentialGroup()
                        .addGroup(panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btnRemoveStatic)
                            .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 341, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addGap(69, 69, 69))))
        );
        panelStaticLayout.setVerticalGroup(
            panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelStaticLayout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelNetwork)
                    .addComponent(txtNetworkStatic, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelMask)
                    .addComponent(txtMask, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(panelStaticLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelNextHop)
                    .addComponent(txtNextHop, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(btnAddStatic)
                .addGap(11, 11, 11)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnRemoveStatic)
                .addContainerGap(147, Short.MAX_VALUE))
        );

        pestañasRoutering.addTab("Static", panelStatic);

        panelRIP.setBackground(new java.awt.Color(255, 255, 255));

        labelNetwork1.setFont(new java.awt.Font("Tahoma", 0, 14));
        labelNetwork1.setText("Network:");

        btnAddRIP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/add16x16.png"))); // NOI18N
        btnAddRIP.setText("Agregar");
        btnAddRIP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddRIPActionPerformed(evt);
            }
        });

        tblDireccionesDeRed.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null},
                {null}
            },
            new String [] {
                "Direcciones de Red"
            }
        ));
        tblDireccionesDeRed.setGridColor(new java.awt.Color(255, 255, 255));
        jScrollPane2.setViewportView(tblDireccionesDeRed);

        btnRemoveRIP.setIcon(new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/eliminar16x16.png"))); // NOI18N
        btnRemoveRIP.setText("Eliminar");
        btnRemoveRIP.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnRemoveRIPActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout panelRIPLayout = new javax.swing.GroupLayout(panelRIP);
        panelRIP.setLayout(panelRIPLayout);
        panelRIPLayout.setHorizontalGroup(
            panelRIPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRIPLayout.createSequentialGroup()
                .addContainerGap()
                .addGroup(panelRIPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(panelRIPLayout.createSequentialGroup()
                        .addGroup(panelRIPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, panelRIPLayout.createSequentialGroup()
                                .addComponent(labelNetwork1)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtNetworkRIP, javax.swing.GroupLayout.DEFAULT_SIZE, 219, Short.MAX_VALUE))
                            .addComponent(btnAddRIP))
                        .addGap(131, 131, 131))
                    .addGroup(panelRIPLayout.createSequentialGroup()
                        .addGroup(panelRIPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(btnRemoveRIP)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 341, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addContainerGap())))
        );
        panelRIPLayout.setVerticalGroup(
            panelRIPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(panelRIPLayout.createSequentialGroup()
                .addGap(23, 23, 23)
                .addGroup(panelRIPLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(labelNetwork1)
                    .addComponent(txtNetworkRIP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnAddRIP)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 157, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(btnRemoveRIP)
                .addContainerGap(131, Short.MAX_VALUE))
        );

        pestañasRoutering.addTab("RIP", panelRIP);

        javax.swing.GroupLayout panelRoutingLayout = new javax.swing.GroupLayout(panelRouting);
        panelRouting.setLayout(panelRoutingLayout);
        panelRoutingLayout.setHorizontalGroup(
            panelRoutingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pestañasRoutering, javax.swing.GroupLayout.DEFAULT_SIZE, 425, Short.MAX_VALUE)
        );
        panelRoutingLayout.setVerticalGroup(
            panelRoutingLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(pestañasRoutering, javax.swing.GroupLayout.DEFAULT_SIZE, 442, Short.MAX_VALUE)
        );

        Pestañas.addTab("Routing", new javax.swing.ImageIcon(getClass().getResource("/tsb/UI/Imagenes/routing16x16.png")), panelRouting); // NOI18N

        panelConsola.setBackground(new java.awt.Color(255, 255, 255));

        txtAConsola.setBackground(new java.awt.Color(0, 0, 0));
        txtAConsola.setColumns(20);
        txtAConsola.setFont(new java.awt.Font("Arial", 0, 12)); // NOI18N
        txtAConsola.setForeground(new java.awt.Color(255, 255, 255));
        txtAConsola.setRows(5);
        txtAConsola.setText("router\\");
            txtAConsola.setWrapStyleWord(true);
            txtAConsola.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
            txtAConsola.addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    txtAConsolaKeyPressed(evt);
                }
                public void keyReleased(java.awt.event.KeyEvent evt) {
                    txtAConsolaKeyReleased(evt);
                }
                public void keyTyped(java.awt.event.KeyEvent evt) {
                    txtAConsolaKeyTyped(evt);
                }
            });
            jScrollPane3.setViewportView(txtAConsola);

            txtComando.setBackground(new java.awt.Color(0, 0, 0));
            txtComando.setForeground(new java.awt.Color(255, 255, 255));
            txtComando.setCaretColor(new java.awt.Color(255, 255, 255));
            txtComando.setCursor(new java.awt.Cursor(java.awt.Cursor.TEXT_CURSOR));
            txtComando.addKeyListener(new java.awt.event.KeyAdapter() {
                public void keyPressed(java.awt.event.KeyEvent evt) {
                    txtComandoKeyPressed(evt);
                }
                public void keyReleased(java.awt.event.KeyEvent evt) {
                    txtComandoKeyReleased(evt);
                }
            });

            javax.swing.GroupLayout panelConsolaLayout = new javax.swing.GroupLayout(panelConsola);
            panelConsola.setLayout(panelConsolaLayout);
            panelConsolaLayout.setHorizontalGroup(
                panelConsolaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, panelConsolaLayout.createSequentialGroup()
                    .addContainerGap()
                    .addGroup(panelConsolaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addComponent(jScrollPane3, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE)
                        .addComponent(txtComando, javax.swing.GroupLayout.DEFAULT_SIZE, 400, Short.MAX_VALUE))
                    .addContainerGap())
            );
            panelConsolaLayout.setVerticalGroup(
                panelConsolaLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(panelConsolaLayout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 253, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                    .addComponent(txtComando, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addContainerGap(152, Short.MAX_VALUE))
            );

            Pestañas.addTab("Consola", panelConsola);

            javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
            this.setLayout(layout);
            layout.setHorizontalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(Pestañas, javax.swing.GroupLayout.PREFERRED_SIZE, 425, javax.swing.GroupLayout.PREFERRED_SIZE)
            );
            layout.setVerticalGroup(
                layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addComponent(Pestañas, javax.swing.GroupLayout.PREFERRED_SIZE, 472, javax.swing.GroupLayout.PREFERRED_SIZE)
            );
        }// </editor-fold>//GEN-END:initComponents

    
    private void btnAgregarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAgregarActionPerformed
        int var=this.cmbIntefaces.getSelectedIndex();
        
        if(cantidadPestañas()<=10) {
            switch(var) {
                case 0:
                    PanelEthernetRouter pe = new PanelEthernetRouter();
                    //                   pe.setAsignacion(this.getAsignacionIP());
                    pe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pe,"Ethernet",this.pisicionLibre());
                    //contador++;
                    break;
                case 1:
                    PanelFastEthernetRouter pfe = new PanelFastEthernetRouter();
                    //                     pfe.setAsignacion(this.getAsignacionIP());
                    pfe.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pfe,"Fast Ethernet RJ45",this.pisicionLibre());
                    //contador++;
                    break;
                case 2:
                    //falta panelfastethernetfibrarouter
                    PanelGigabitFibraRouter pfef = new PanelGigabitFibraRouter();
                    //                     pfef.setAsignacion(this.getAsignacionIP());
                    pfef.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pfef,"Fast Ethernet Fibra Óptica",this.pisicionLibre());
                    //                    contador++;
                    break;
                case 3:
                    PanelGigabitEthernetRouter pg = new PanelGigabitEthernetRouter();
                    //                     pg.setAsignacion(this.getAsignacionIP());
                    pg.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pg,"Gigabit RJ45",this.pisicionLibre());
                    //                    contador++;
                    break;
                case 4:
                    PanelGigabitFibraRouter pgf = new PanelGigabitFibraRouter();
                    //                     pgf.setAsignacion(this.getAsignacionIP());
                    pgf.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pgf,"Gigabit Fibra Óptica",this.pisicionLibre());
                    //                    contador++;
                    break;
                case 5:
                    PanelSerialRouter ps = new PanelSerialRouter();
                    //                     ps.setAsignacion(this.getAsignacionIP());
                    ps.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(ps,"Serial",this.pisicionLibre());
                    //                    contador++;
                    break;
                case 6:
                    PanelWirelessRouter pw = new PanelWirelessRouter();
                    //                     pw.setAsignacionIP(this.getAsignacionIP());
                    pw.setBounds(0, 0, 396, 320);//(X,Y, ancho,alto,)[396, 320]
                    this.insertarPanel(pw,"Wireless",this.pisicionLibre());
                    //                    contador++;
                    break;
                    
            }
        } else {
            VentanaDeError.mostrarDialog("No se puede agregar interfaz", "             El Router solo acepta 10 Interfaces de coneccion.\nPara agregar una nueva debe quitar alguna de las interfaces actuales", 0);
        }
}//GEN-LAST:event_btnAgregarActionPerformed

    private void btnQuitarInterfazPestaña1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña1ActionPerformed
        
        this.panelPestañaInterfaz1.remove(this.panelPestañaInterfaz1.getComponent(1));
        this.pestañas[0]=false;
        pestañasInterfaces.setTitleAt(0, "Interfaz 1");
        this.btnQuitarInterfazPestaña1.setVisible(false);
        //contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña1ActionPerformed

    private void btnQuitarInterfazPestaña2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña2ActionPerformed
        
        this.panelPestañainterfaz2.remove(this.panelPestañainterfaz2.getComponent(1));
        this.pestañas[1]=false;
        pestañasInterfaces.setTitleAt(1, "Interfaz 2");
        this.btnQuitarInterfazPestaña2.setVisible(false);
        // contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña2ActionPerformed

    private void btnQuitarInterfazPestaña3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña3ActionPerformed
        this.panelPestañaInterfaz3.remove(this.panelPestañaInterfaz3.getComponent(1));
        this.pestañas[2]=false;
        pestañasInterfaces.setTitleAt(2, "Interfaz 3");
        this.btnQuitarInterfazPestaña3.setVisible(false);
        //contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña3ActionPerformed

    private void btnQuitarInterfazPestaña4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña4ActionPerformed
        this.panelPestañaInterfaz4.remove(this.panelPestañaInterfaz4.getComponent(1));
        this.pestañas[3]=false;
        pestañasInterfaces.setTitleAt(3, "Interfaz 4");
        this.btnQuitarInterfazPestaña4.setVisible(false);
        // contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña4ActionPerformed

    private void btnQuitarInterfazPestaña5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña5ActionPerformed
        this.panelPestañaInterfaz5.remove(this.panelPestañaInterfaz5.getComponent(1));
        this.pestañas[4]=false;
        pestañasInterfaces.setTitleAt(4, "Interfaz 5");
        this.btnQuitarInterfazPestaña5.setVisible(false);
        //contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña5ActionPerformed

    private void btnQuitarInterfazPestaña6ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña6ActionPerformed
        this.panelPestañaInterfaz6.remove(this.panelPestañaInterfaz6.getComponent(1));
        this.pestañas[5]=false;
        pestañasInterfaces.setTitleAt(5, "Interfaz 6");
        this.btnQuitarInterfazPestaña6.setVisible(false);
        //contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña6ActionPerformed

    private void btnQuitarInterfazPestaña7ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña7ActionPerformed
        this.panelPestañaInterfaz7.remove(this.panelPestañaInterfaz7.getComponent(1));
        this.pestañas[6]=false;
        pestañasInterfaces.setTitleAt(6, "Interfaz 7");
        this.btnQuitarInterfazPestaña7.setVisible(false);
        // contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña7ActionPerformed

    private void btnQuitarInterfazPestaña8ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña8ActionPerformed
        this.panelPestañaInterfaz8.remove(this.panelPestañaInterfaz8.getComponent(1));
        this.pestañas[7]=false;
        pestañasInterfaces.setTitleAt(7, "Interfaz 8");
        this.btnQuitarInterfazPestaña8.setVisible(false);
        // contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña8ActionPerformed

    private void btnQuitarInterfazPestaña9ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña9ActionPerformed
        this.panelPestañaInterfaz9.remove(this.panelPestañaInterfaz9.getComponent(1));
        this.pestañas[8]=false;
        pestañasInterfaces.setTitleAt(8, "Interfaz 9");
        this.btnQuitarInterfazPestaña9.setVisible(false);
        //contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña9ActionPerformed

    private void btnQuitarInterfazPestaña10ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnQuitarInterfazPestaña10ActionPerformed
        this.panelPestañaInterfaz10.remove(this.panelPestañaInterfaz10.getComponent(1));
        this.pestañas[9]=false;
        pestañasInterfaces.setTitleAt(9, "Interfaz 10");
        this.btnQuitarInterfazPestaña10.setVisible(false);
        // contador--;
}//GEN-LAST:event_btnQuitarInterfazPestaña10ActionPerformed

    private void btnAddRIPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddRIPActionPerformed
        
        String nombreRouter = this.ventanaRouter.getBtnPersonalizado().getText();
        String IP = this.txtNetworkRIP.getText();
        this.ventanaRouter.getGestorDisp().agregarRedARouter(nombreRouter,IP);
        
        for(int i=0; i<this.tblDireccionesDeRed.getModel().getRowCount();i++) {
            if(this.tblDireccionesDeRed.getModel().getValueAt(i, 0)==null) {
                this.tblDireccionesDeRed.getModel().setValueAt(IP, i, 0);//fila columna
                break;
            }
        }
        this.txtNetworkRIP.setText("");
}//GEN-LAST:event_btnAddRIPActionPerformed

    private void btnRemoveRIPActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveRIPActionPerformed
        
        
                int indice= this.tblDireccionesDeRed.getSelectedRow();
        
                if(indice!=-1) {
                    String ip=(String)this.tblDireccionesDeRed.getModel().getValueAt(indice,0);
                    String nombreRouter = this.ventanaRouter.getBtnPersonalizado().getText();
                    this.ventanaRouter.getGestorDisp().removerRedARouter(nombreRouter,ip);
        
                    this.tblDireccionesDeRed.getModel().setValueAt("", indice, 0);
        
                }
}//GEN-LAST:event_btnRemoveRIPActionPerformed

    private void txtAConsolaKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAConsolaKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtAConsolaKeyPressed

    private void txtAConsolaKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAConsolaKeyReleased
        // TODO add your handling code here:
    }//GEN-LAST:event_txtAConsolaKeyReleased

    private void txtAConsolaKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtAConsolaKeyTyped
        // TODO add your handling code here:
    }//GEN-LAST:event_txtAConsolaKeyTyped

    private void txtComandoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtComandoKeyPressed
        // TODO add your handling code here:
    }//GEN-LAST:event_txtComandoKeyPressed

    private void txtComandoKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtComandoKeyReleased

        if(evt.getKeyCode()==KeyEvent.VK_ENTER)//si se aprieta enter
        {
            if(this.txtComando.getText().compareTo("?")==0) {

                this.txtAConsola.append(this.arbol.getNodoAuxiliar().comandosHijos());
                //this.txtAConsola.append(arbol.getPila().toString());
                this.txtComando.setText("");
                return;
            }
            for(int i=0; i<cadena.length;i++)
              {
               cadena[i]="";
              }
            String comando=this.txtComando.getText();
            StringTokenizer tokens = new StringTokenizer(comando," ");
            int i=0;
            while(tokens.hasMoreTokens()&&i<10)
            {
             if(cadena[i].equals(""))//verificar que no se superen las 6 sentencia
             cadena[i]=tokens.nextToken();
             i++;
              }

          String acum="";
          for(int cou=0;cou<cadena.length;cou++){
              acum+=cadena[cou];
            if(this.arbol.getNodoAuxiliar().esHijo(acum))//if(this.arbol.getNodoAuxiliar().esHijo(comando))//es hijo
            {
                if(arbol.accederHijo(acum)) {

                    if(this.arbol.getNodoAuxiliar().esComando(acum)) {

                        if( acum.equals("host name"))
                        {
                            String algo="";
                            for(int p=cou+1;p<cadena.length;p++)
                            algo+=cadena[p]+" ";
                           this.txtHostname.setText(algo);//armo la cadena con los restantes casilleros que no se han revisado
                        }
                        if(acum.equals("ip address"))
                        {;}
                        
                        //  VentanaDeError.mostrarDialog("Es Comando", "El comando ingresado es "+comando, 2);
                        
                        this.arbol.setNodoAuxiliar(this.arbol.getNodoAuxiliar().getPadre());
                        
                    } else {
                        //this.txtAConsola.append("\n"+arbol.getNodoAuxiliar().toStrign());
                        this.txtAConsola.append("\n"+arbol.getPila().toString());
                    }
                }
            }

            else//esto nose deberia hacer! si se quiere volver al padre se debe usar la palaba "exit"
            {
                if(this.arbol.getNodoAuxiliar().esPadre(acum)) {
                    if(arbol.accederPadre()) {
                        // this.txtAConsola.append("\n"+arbol.getNodoAuxiliar().toStrign());
                        this.txtAConsola.append("\n"+arbol.getPila().toString());
                    }
                }
            }
            acum+=" ";
            }//fin for
            this.txtComando.setText("");

        }
}//GEN-LAST:event_txtComandoKeyReleased

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTabbedPane Pestañas;
    private javax.swing.JButton btnAddRIP;
    private javax.swing.JButton btnAddStatic;
    private javax.swing.JButton btnAgregar;
    private javax.swing.JButton btnBorrarNVRAM;
    private javax.swing.JButton btnCargarRunningConfig;
    private javax.swing.JButton btnCargarStartupConfig;
    private javax.swing.JButton btnExportarRunningConfig;
    private javax.swing.JButton btnExportarStartupConfig;
    private javax.swing.JButton btnGuardarNVRAM;
    private javax.swing.JButton btnQuitarInterfazPestaña1;
    private javax.swing.JButton btnQuitarInterfazPestaña10;
    private javax.swing.JButton btnQuitarInterfazPestaña2;
    private javax.swing.JButton btnQuitarInterfazPestaña3;
    private javax.swing.JButton btnQuitarInterfazPestaña4;
    private javax.swing.JButton btnQuitarInterfazPestaña5;
    private javax.swing.JButton btnQuitarInterfazPestaña6;
    private javax.swing.JButton btnQuitarInterfazPestaña7;
    private javax.swing.JButton btnQuitarInterfazPestaña8;
    private javax.swing.JButton btnQuitarInterfazPestaña9;
    private javax.swing.JButton btnRemoveRIP;
    private javax.swing.JButton btnRemoveStatic;
    private javax.swing.JComboBox cmbIntefaces;
    private javax.swing.JComboBox cmbencendido;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JScrollPane jScrollPane3;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JTable jTable1;
    private javax.swing.JLabel labelEncendido;
    private javax.swing.JLabel labelHostname;
    private javax.swing.JLabel labelInterfacesDeConeccion;
    private javax.swing.JLabel labelMask;
    private javax.swing.JLabel labelNVRAM;
    private javax.swing.JLabel labelNetwork;
    private javax.swing.JLabel labelNetwork1;
    private javax.swing.JLabel labelNextHop;
    private javax.swing.JLabel labelNombreAMostrar;
    private javax.swing.JLabel labelRunnigConfig;
    private javax.swing.JPanel panelConfiguraciones;
    private javax.swing.JPanel panelConsola;
    private javax.swing.JPanel panelInterfaces;
    private javax.swing.JPanel panelPestañaInterfaz1;
    private javax.swing.JPanel panelPestañaInterfaz10;
    private javax.swing.JPanel panelPestañaInterfaz3;
    private javax.swing.JPanel panelPestañaInterfaz4;
    private javax.swing.JPanel panelPestañaInterfaz5;
    private javax.swing.JPanel panelPestañaInterfaz6;
    private javax.swing.JPanel panelPestañaInterfaz7;
    private javax.swing.JPanel panelPestañaInterfaz8;
    private javax.swing.JPanel panelPestañaInterfaz9;
    private javax.swing.JPanel panelPestañainterfaz2;
    private javax.swing.JPanel panelRIP;
    private javax.swing.JPanel panelRouting;
    private javax.swing.JPanel panelStatic;
    private javax.swing.JTabbedPane pestañasInterfaces;
    private javax.swing.JTabbedPane pestañasRoutering;
    private javax.swing.JTable tblDireccionesDeRed;
    private javax.swing.JTextArea txtAConsola;
    private javax.swing.JTextField txtComando;
    private javax.swing.JTextField txtHostname;
    private javax.swing.JTextField txtMask;
    private javax.swing.JTextField txtNetworkRIP;
    private javax.swing.JTextField txtNetworkStatic;
    private javax.swing.JTextField txtNextHop;
    private javax.swing.JTextField txtNombreAMostrar;
    // End of variables declaration//GEN-END:variables

 class ComboBoxRenderer extends JLabel
                           implements ListCellRenderer {
        private Font uhOhFont;

        public ComboBoxRenderer() {
            setOpaque(true);
            setHorizontalAlignment(CENTER);
            setVerticalAlignment(CENTER);
        }

        /*
         * This method finds the image and text corresponding
         * to the selected value and returns the label, set up
         * to display the text and image.
         */
        public Component getListCellRendererComponent(
                                           JList list,
                                           Object value,
                                           int index,
                                           boolean isSelected,
                                           boolean cellHasFocus) {
            //Get the selected index. (The index param isn't
            //always valid, so just use the value.)
            int selectedIndex = ((Integer)value).intValue();

            if (isSelected) {
                setBackground(list.getSelectionBackground());
                setForeground(list.getSelectionForeground());
            } else {
                setBackground(list.getBackground());
                setForeground(list.getForeground());
            }

            //Set the icon and text.  If icon was null, say so.
            ImageIcon icon = images[selectedIndex];
            String pet = opciones[selectedIndex];
            setIcon(icon);
            if (icon != null) {
                setText(pet);
                setFont(list.getFont());
            } else {
                setUhOhText(pet + " (no image available)",
                            list.getFont());
            }

            return this;
        }

        //Set the font and text when no image was found.
        protected void setUhOhText(String uhOhText, Font normalFont) {
            if (uhOhFont == null) { //lazily create this font
                uhOhFont = normalFont.deriveFont(Font.ITALIC);
            }
            setFont(uhOhFont);
            setText(uhOhText);
        }
    }

}
